package qlsl.androiddesign.adapter.subadapter;

import java.util.List;

import com.qlsl.androiddesign.demo.R;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import qlsl.androiddesign.activity.baseactivity.BaseActivity;
import qlsl.androiddesign.adapter.baseadapter.BaseAdapter;
import qlsl.androiddesign.entity.commonentity.User;
import qlsl.androiddesign.entity.otherentity.PoemDynamic;
import qlsl.androiddesign.util.commonutil.ImageUtils;

public class UserAdapter extends BaseAdapter<PoemDynamic> {

	public UserAdapter(BaseActivity activity, List<PoemDynamic> list) {
		super(activity, list);
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = getItemView(convertView, R.layout.listitem_user);

		ImageView iv_head = getView(convertView, R.id.iv_head);
		TextView tv_name = getView(convertView, R.id.tv_name);
		TextView tv_content = getView(convertView, R.id.tv_content);

		PoemDynamic item = getItem(position);
		String content = "婉约派，" + (position + 1) + "岁";
		User user = item.getUser();

		ImageUtils.circle(activity, user.getAvatar(), iv_head);
		tv_name.setText(user.getName());
		tv_content.setText(content);

		return convertView;
	}
}
